#ifndef LivingEntity_h__
#define LivingEntity_h__
#include "BaseGameEntity.h"
#include "Message/ICallback.h"

class StateMachine; 
class State;
class Visual;


class ChangeStateCallback : public ICallback   
{
	void function(void* parent, Message* msg);
};


class GetAttackCallback : public ICallback   
{
	void function(void* parent, Message* msg);
};



typedef struct _Attribute
{
	int walkSpeed;
	int atkSpeed;

}Attribute;
enum DIRECTION{
	DIRECTION_DOWN,
	DIRECTION_LDOWN, 
	DIRECTION_LEFT, 
	DIRECTION_LUP, 
	DIRECTION_UP, 
	DIRECTION_RUP, 
	DIRECTION_RIGHT, 
	DIRECTION_RDOWN
};

class LivingEntity : public BaseGameEntity
{
public:

	StateMachine* GetStateMachine() const;
	void AddState(State* pState);
	void SetDirection(DIRECTION dir);
	void SetDirection(int dx, int dy);
	DIRECTION GetDirection()const;
	Attribute& GetAttribute();
protected:
	//should be created only by its child.
	LivingEntity(ENTITYTYPE type,Visual* pVisual);
protected:
	Attribute m_attribute;
	StateMachine* m_pStateMachine;
	DIRECTION m_direction;
	ChangeStateCallback m_changeStateCallback;
	GetAttackCallback m_getAtkCallback;
};



#endif // LivingEntity_h__